Is it good or bad practice to use var everywhere? [closed]
Posted
by Earlz
on Stack Overflow
See other posts from Stack Overflow
or by Earlz
Published on 2010-03-11T01:00:15Z
Indexed on
2010/03/21
12:41 UTC
Read the original article
Hit count: 421
Possible Duplicate:
Use of var keyword in C#
Hello, I've recently been discovering the awesomeness that is the var
keyword in C#.
Well, I didn't think about it before but I just wrote lines of code that are along the lines of
var con=CreateNewConnection();
Where this would usually be
IdbConnection con=CreateNewConnection();
Is this a good use of var
? Is it possible to use var
too often? Are there any downsides to using it?
Also, one more point of consideration: We are not worried about backwards compatability. We just care that it runs on .NET 3.5
© Stack Overflow or respective owner